#include "MathUtil.h"

MathUtil::MathUtil(void)
{
}

MathUtil::~MathUtil(void)
{
}

int MathUtil::clamp( int x, int min, int max )
{
	if (x < min)
		return min;
	if (x > max)
		return max;
	return x;
}

float MathUtil::clamp( float x, float min, float max )
{
	if (x < min)
		return min;
	if (x > max)
		return max;
	return x;
}

double MathUtil::clamp( double x, double min, double max )
{
	if (x < min)
		return min;
	if (x > max)
		return max;
	return x;
}

int MathUtil::min( int a, int b, int c )
{
	int min = a;
	if (min < b)
		min = b;
	if (min < c)
		min = c;
	return min;
}

float MathUtil::min( float a, float b, float c )
{
	float min = a;
	if (min < b)
		min = b;
	if (min < c)
		min = c;
	return min;
}

double MathUtil::min( double a, double b, double c )
{
	double min = a;
	if (min < b)
		min = b;
	if (min < c)
		min = c;
	return min;
}

int MathUtil::max( int a, int b, int c )
{
	int max = a;
	if (max < b)
		max = b;
	if (max < c)
		max = c;
	return max;
}

float MathUtil::max( float a, float b, float c )
{
	float max = a;
	if (max < b)
		max = b;
	if (max < c)
		max = c;
	return max;
}

double MathUtil::max( double a, double b, double c )
{
	double max = a;
	if (max < b)
		max = b;
	if (max < c)
		max = c;
	return max;
}